package com.oa.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.oa.bean.Section;
import com.oa.service.DeptService;

@Controller
public class DeptController {

	@Autowired
	DeptService deptService;
	
	@RequestMapping("add_Section")
	public String add_Section(Section section){
		String result=deptService.addDept(section);
		if("true".equals(result)){
			return "redirect:Template/deptManage.jsp";	
		}
		return "";
	}
	
	@RequestMapping("getDeptList")
	@ResponseBody
	public List<Section> getDeptList(){
		List<Section> list = deptService.getDeptList();
		return list;
	}
	
	@RequestMapping("changeSectionInfo2")
	@ResponseBody
	public String changeSectionInfo2(Section section){
		String result = deptService.changeDept(section);
		return result;
	}
	
}
